<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*,java.util.*,support.*"%>
<%@ page import="javax.sql.*"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Set up Page</title>
</head>
<body>

	<div style="color: red">
		<html:errors />
	</div>
	<logic:equal name="ChairsHomeForm" property="newReview" value="true">
   		Please enter at least 3 reviewers.
		<!--  button to add reviewer -->
		<html:form action="/insertReviewer">
			<table id="addReviewer" border="1">
				<tr>
					<td>Username:</td>
					<td><html:text name="ReviewerFormInsert" property="username"
							size="13" /></td>
				</tr>
				
				<tr>
					<td>Password:</td>
					<td><html:password name="ReviewerFormInsert"
							property="password" size="14" /></td>
				</tr>

				<tr>
					<td align="right" colspan="2"><html:submit value="Add" /></td>
				</tr>
			</table>
		</html:form>

		<%
			// Get the reviewersRowSet
				RowSet crsReviewers = (RowSet) request
						.getAttribute("crsReviewers");
				String user = "";
		%>
		Reviewers: 
		<p>
		<table id="reviewer" border="1">
			<%
				// Iterate over the RowSet
					while (crsReviewers.next()) {
			%>
			<html:form action="/deleteReviewer">

				<%
					user = crsReviewers.getString("username");
				%>
				<html:hidden property="id"
					value="<%=Integer.toString(crsReviewers.getInt(1)) %>" />

				<%-- Get the username --%>
				<tr>
					<td width="120" align="center"><%=user%></td>
					<td align="right"><html:submit value="Delete" /></td>
				</tr>
			</html:form>

			<%
				}
			%>
		</table>
		<!--  button to start review process -->
		<P>
			<html:form action="/startReview">
				<html:hidden name="ChairsHomeForm" property="newReview"
					value="false" />
				<html:submit value="Start" />
			</html:form>
		<p>
			<html:form action="/Logoff">
				<html:submit value="Logoff" />
			</html:form>
	</logic:equal>

	<logic:notEqual name="ChairsHomeForm" property="newReview" value="true">
		Please choose where to go.
		<!-- button to get view all the applications -->
		<html:form action="/reviewerAna">
			<input type="submit" name="whichpage" value="View Application">
		</html:form>

		<html:form action="/discpAna">
			<input type="submit" name="whichpage" value="Discipline Analytics">
		</html:form>

		<html:form action="/specAna">
			<input type="submit" name="whichpage"
				value="Specialization Analytics">
		</html:form>

		<html:form action="/Logoff">
			<html:submit value="Logoff" />
		</html:form>
	</logic:notEqual>

</body>
</html>
